package com.red.wood.module.system.dao.impl;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.apache.commons.lang3.StringUtils;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import com.red.wood.module.system.dao.SwUserDao;

@Repository
public class SwUserDaoImpl implements SwUserDao{

	@Resource(name="jdbcTemplateSqlServer")
	private JdbcTemplate jdbcTemplate;
	
	@Override
	public Map<String, Object> getById(String id) {
		if(StringUtils.isNotBlank(id)){
			//String sql = "select * from SW_User where id = " + id;
			String sql = "select pkid,username as UserName,realname as Company,email as Email,address as Address,tel as Mobile,nickname as Contact from member where pkid="+id;
			List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
			if(null != list && !list.isEmpty()){
				return list.get(0);
			}
		}
		return null;
	}

}
